const setZero=(t)=>{
    return t < 10 ? "0" + t : t
}
export default {     
    zero:(val)=>{
        let num= val==null?'10.00':val;
        return num.replace(/\.00|0$/,'');
    },
    filterServerTime(t){
        if(!t) return false;
        let e = new Date(+t*1e3),
            date = e.getDate(),
            nows = new Date().getDate(),
            dateStr=nows<=date?'今日':'明日';
        return `${dateStr} ${setZero(e.getHours())}:${setZero(e.getMinutes())}`;
        
    },
    repHtml(val){
        return val.replace(/<[^>]+>/g,'');
    },
    formatDate(t) {
        if (t) {
            var e = new Date(+t*1e3);
            return e.getFullYear() + "-" + (setZero(e.getMonth() + 1) + "-") + setZero(e.getDate())+" "+setZero(e.getHours())+":"+setZero(e.getMinutes())
        }
    }
}